package elm

import (
	"awesomeProject2/write_line"
	"io/ioutil"
	"log"
	"strings"
)

func WriteFilePj() {
	files, err := ioutil.ReadDir("C:\\Users\\admin\\GolandProjects\\waimaigo\\json\\pj\\")
	if err != nil {
		log.Fatal(err)
	}

	pjC := make([]string, 0)

	for _, file := range files {
		pj := GetPj("C:\\Users\\admin\\GolandProjects\\waimaigo\\json\\pj\\" + file.Name())
		for _, comment := range pj.Data.Comments {

			index := strings.LastIndex(comment.Comment, "#")

			println(comment.Comment[index+1:])
			pjC = append(pjC, comment.Comment[index+1:])
		}
	}

	write_line.WriteLineTxm(pjC, "C:\\Users\\Admin\\go\\src\\awesomeProject2\\pj\\text.txt")

}
